#include <stdio.h>
#include <string>

template <typename T> void swap(T& x, T& y)
{
   T tmp = x;
   x = y;
   y = tmp;
}

template <typename T> void arrange(T& x, T& y, T& z)
{
   if (x > y)
      swap(x, y);

   if (y > z)
      swap(y, z);

   if (x > y)
      swap(x, y);
}

int main()
{
   // test 1a
   
   int x = 5;
   int y = 6;
   int z = 0;
   
   swap(x, y);
   printf("swapped: 6,5 = %d,%d\n", x, y);
   
   // test 1b
   
   x = 1;
   y = 2;
   z = 3;
   arrange(x, y, z);
   printf("%d,%d,%d\n", x, y, z);

   x = 3;
   y = 2;
   z = 1;
   arrange(x, y, z);
   printf("%d,%d,%d\n", x, y, z);

   x = 1;
   y = 3;
   z = 2;
   arrange(x, y, z);
   printf("%d,%d,%d\n", x, y, z);

   x = 2;
   y = 1;
   z = 3;
   arrange(x, y, z);
   printf("%d,%d,%d\n", x, y, z);

   x = 2;
   y = 3;
   z = 1;
   arrange(x, y, z);
   printf("%d,%d,%d\n", x, y, z);
   
   std::string s1 = "C";
   std::string s2 = "A";
   std::string s3 = "B";

   arrange(s1, s2, s3);
   printf("%s,%s,%s\n", s1.c_str(), s2.c_str(), s3.c_str());

   s1 = "aaaac";
   s2 = "aaaab";
   s3 = "aaaaa";

   arrange(s1, s2, s3);
   printf("%s,%s,%s\n", s1.c_str(), s2.c_str(), s3.c_str());

   // test 1c
   // for swap: type should have copy constructor and operators =()

   // test 1d
   // for arrange: type should have copy constructor and operators =() and >()

   
   
}
